<?php

/**
 * 缓存类
 * @author 暮雨秋晨
 * @copyright 2014
 */

class Cache
{
    private static $cache = null;
    private $cache_block = array(); //块缓存
    private $cache_global = null; //全局缓存
    private static $cache_dir = ''; //缓存目录

    public static function setCacheDir($dir)
    {
        $dir = trim($dir);
        if (!empty($dir)) {
            $path = RTM_DIR . $dir . DS;
            if (is_dir($path)) {
                self::$cache_dir = $path;
                return true;
            } else {
                throw new exception('[CacheError] Cache directory does not exist', 0);
            }
        }
    }

    private function __construct()
    {

    }

    /**
     * 单件模式获取缓存对象
     */
    public static function getInstance()
    {
        if (!self::$cache) {
            self::$cache = new self;
        }
        return self::$cache;
    }

    public function setGlobalCache(){
        
    }
}

?>